<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="/js/jquery-1.9.1.min.js"></script>
        <script src="/js/prettify.js"></script>
        <style>
            @import "http://fonts.googleapis.com/css?family=Lato:300,400,700";
            body{
                font-family:"Lato",Arial;
        }
        </style>
    </head>
    <body>
        <a href="/">Home</a>
        <h2>Request Echo</h2>
        <p>Once you submit the form the next page will echo all information submitted to server.</p>
        <h3>Server code</h3>
        <pre class="prettyprint lang-js">
          app.map('/request_echo_submit',function(req,res){
                var h = req.headers();
                res.contentType('text/html');
                
                res.send("&lt;html>&lt;head>");
                res.send('&lt;style>@import "http://fonts.googleapis.com/css?family=Lato:300,400,700";'+
            'body{ font-family:"Lato",Arial; }&lt;/style>');
    res.send("&lt;/head>")
                res.send("&lt;body>")
                res.send('&lt;a href="/" >Home&lt;/a>&lt;br>&lt;br>')
                
                res.send('HTTP Method : '+req.method()+'&lt;br>')
                res.send('Request URI : '+req.uri()+'&lt;br>')
                res.send("&lt;h2>Header&lt;/h2>&lt;ol>")
                
                for(item in h){
                    res.send("&lt;li>"+h[item]+' : '+req.header(h[item])+'&lt;/li>');
                }
                res.send("&lt;/ol>")
                var d = req.params();
                res.send("&lt;h2>Params&lt;/h2>&lt;ol>")
                for(item in d){
                    res.send("&lt;li>"+d[item]+' : '+req.param(d[item])+'&lt;/li>');
                }
                res.send("&lt;/ol>")
                var f = req.files();
                res.send("&lt;h2>Files&lt;/h2>&lt;ol>")
                for(item in f){
                    res.send("&lt;li>"+f[item]+' : '+req.file(f[item])+'&lt;/li>');
                }
                res.send("&lt;/ol>")
                res.send("&lt;/body>&lt;/html>")
        });
        
        </pre>
        <h3>Sample HTML FORM</h3>
        <form action="/request_echo_submit" method="POST" enctype="multipart/form-data">
            <label>Your Name <input type="text" name="name"></label><br>
            <label>Your Email <input type="text" name="email"></label><br>
            <p>Attachment:</p>
            <input type="file" name="file" ><br>
            <input type="submit" name="submit" value="submit">
        </form>
    </body>
</html>
